package com.originskyseed.platform.role.service;

import java.util.List;
import java.util.Map;

import com.originskyseed.platform.core.base.BasePage;
import com.originskyseed.platform.role.model.RoleRelUser;

/**
 * 角色与用户关系表Service接口类（OSI_ROLE_REL_USER）
 * 
 * @author LiangMingHui
 */
public interface IRoleRelUserService {

	/**
	 * 删除记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 * 
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(RoleRelUser record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(RoleRelUser record) throws Exception;

	/**
	 * 更新记录
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(RoleRelUser record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(RoleRelUser record) throws Exception;

	/**
	 * 查询记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public RoleRelUser selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询列表
	 * 
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<RoleRelUser> selectList(RoleRelUser record) throws Exception;

	/**
	 * 分页查询列表
	 * 
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<RoleRelUser> selectListByPage(Map<String, Object> params, BasePage<RoleRelUser> page) throws Exception;

	/**
	 * 根据用户标识重新关联记录
	 * 
	 * @param userId
	 * @param roleIds
	 * @return
	 * @throws Exception
	 */
	public int deleteAndInsertByUserId(String userId, List<String> roleIds) throws Exception;

	/**
	 * 根据角色标识重新关联记录
	 * 
	 * @param roleId
	 * @param userIds
	 * @return
	 * @throws Exception
	 */
	public int deleteAndInsertByRoleId(String roleId, List<String> userIds) throws Exception;

	/**
	 * 根据用户标识获取关联记录
	 * 
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public List<RoleRelUser> selectByUserId(String userId) throws Exception;

	/**
	 * 根据角色标识获取关联记录
	 * 
	 * @param roleId
	 * @return
	 * @throws Exception
	 */
	public List<RoleRelUser> selectByRoleId(String roleId) throws Exception;

	/**
	 * 是否存在用户关联记录
	 * 
	 * @param roleIds
	 * @return
	 * @throws Exception
	 */
	public Boolean existUserId(List<String> roleIds) throws Exception;

	/**
	 * 是否存在用户关联记录
	 *
	 * @param roleId
	 * @return
	 * @throws Exception
	 */
	public Boolean existUserId(String roleId) throws Exception;

}